package data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author Michal Hanzlik, Tomas Jiran
 */
/*
 create table Stat (
 id_statu             INT4                 not null,
 nazev_statu          CHAR(32)             not null,
 constraint PK_STAT primary key (id_statu)
 );
 */
@Entity
@Table(name = "stat")
public class Stat implements Serializable {
    /**
     * id_statu INT4 not null,
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "stat_id_statu_seq")
    @Column(unique=true, nullable = false)
    private final int id_statu;

    /**
     * nazev_statu CHAR(32) not null,
     */
    @Column(nullable = false)
    private String nazev_statu;

    @ManyToMany(mappedBy = "staty")
    private List<Film> filmy;

    public Stat() {
        id_statu = 0;     
        filmy = new ArrayList<>();
    }

    public Stat(int ID, String nazev_statu) {
        this.id_statu = ID;
        this.nazev_statu = nazev_statu;
    }

    @Override
    public String toString() {
        return nazev_statu;
    }

    public int getId_statu() {
        return id_statu;
    }

    public void setNazev_statu(String nazev_statu) {
        this.nazev_statu = nazev_statu;
    }

    public String getNazev_statu() {
        return nazev_statu;
    }

    public List<Film> getFilmy() {
        return filmy;
    }

    public void setFilmy(List<Film> filmy) {
        this.filmy = filmy;
    }
}